package com.mpgame.common.mq;

import java.util.Map;

import org.apache.kafka.common.serialization.Deserializer;

import com.mpgame.common.proto.MQPacket;
import com.mpgame.common.utils.Log;

public class MQPacketDeserializer implements Deserializer<MQPacket>{
    @Override public void configure(Map<String, ?> configs, boolean isKey){}
    @Override public MQPacket deserialize(String topic, byte[] data){
        if(data==null){
            Log.warn("data==null");
            return null;
        }
        try{Log.warn("mq消息序列化中...");return MQPacket.parseFrom(data);}catch(Exception e){Log.warn(e.getMessage());return null;}
    }
    @Override public void close(){}
}
